package com.hkyp.ss.course.provider.model;


import com.hkyp.ss.course.provider.model.base.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;

/**
 * 课评表。
 * 评论者为 createBy字段
 *
 */
@Data
@Entity
@Table(
        indexes = {
                @Index(columnList = "status",name = "statusIndex"),
                //常做查询条件的列加索引
                @Index(columnList = "deleted",name = "deletedIndex"),
        }
)
@DynamicUpdate
@DynamicInsert
@EqualsAndHashCode(callSuper=true)
public class CourseComment extends BaseEntity {

    /**
     * 课程id
     */
    private Long courseId;

    /**
     * 课程名称
     */
    private String title;

    /**
     * 用户id
     */
    private Long userId;

    /**
     * 课评内容
     * 限制长度最长1500字
     */
    @Column(name = "content",length = 2000,columnDefinition = "text")
    private String content;

    /**
     * 课程评分
     * 总共1到10分
     *
     */
    private Integer score;


    /**
     * 逻辑性评分
     * 总共1到10分
     *
     */
    private Integer logicality;

    /**
     * 实用性评分
     * 总共1到10分
     *
     */
    private Integer practicability;

    /**
     * 易学性评分
     * 总共1到10分
     *
     */
    private Integer learnability;


    /**
     * 踩数
     */
    private Integer userDislike = 0;

    /**
     * 点赞数
     */
    private Integer userLike = 0;

    /**
     * 评论数
     * 评论人数      comment
     */
    private Integer commentNum = 0;


    /**
     * 课评状态
     * 默认值为1
     *  1：下架；0：正常
     */
    @Column(name = "status", columnDefinition = "tinyint")
    private Integer status = 0;

    /**
     * 是否删除
     *  1：删除；0：正常
     */
    @Column(name = "deleted", columnDefinition = "tinyint")
    private Integer deleted = 0;

}
